package com.zengqingfa.examples.mybatisplus.enums;

import com.zengqingfa.examples.mybatisplus.dto.UserVo;
import lombok.Getter;

import java.util.Objects;

/**
 * @Description: 动态列表模块枚举
 * @Author: zengqingfa
 * @Date: 2022/10/9
 */
@Getter
public enum DynamicColumnModuleEnum {
    /**
     * 用户
     */
    USER(1, UserVo.class);


    private final Integer type;
    private final Class<?> voClazz;

    DynamicColumnModuleEnum(int type, Class<?> voClazz) {
        this.type = type;
        this.voClazz = voClazz;
    }

    public static DynamicColumnModuleEnum getByType(Integer type) {
        for (DynamicColumnModuleEnum n : DynamicColumnModuleEnum.values()) {
            if (Objects.equals(n.getType(), type)) {
                return n;
            }
        }
        return null;
    }
}
